-- probability_damage2
-- created by shuzy
-- 攻击概率造成额外伤害

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,

    -- 对敌伤害触发
    trigger = function(who, prop, arg)
        local extraDamage = tonumber(prop[2]);

        if DungeonM.getRandSeed("probability_damage2") % 1000 >= prop[3] then
            return 0;
        end

        return math.max(0, extraDamage);
    end,

    desc = function(prop)
        local row = PropM.getRow(prop[1]);
        local desc = row.desc;
        local ron = tonumber(prop[3]) / 10;
        local add = tonumber(prop[2]);

        desc = string.gsub(desc, "{0}", add);
        desc = string.gsub(desc, "{1}", ron);

        return desc;
    end,

    record = function(target, prop, path)
        return false;
    end
};